# This is the lists file that should be used during development for the best
# discovery in the developer's choice of IDE.
cmake_minimum_required(VERSION 3.14)

project(FunctionalPlusDevelopment)

# Test should be added first, because it disables the warning guard
add_subdirectory(
        "${PROJECT_SOURCE_DIR}/../test"
        "${PROJECT_BINARY_DIR}/test"
)

add_subdirectory(
        "${PROJECT_SOURCE_DIR}/../examples"
        "${PROJECT_BINARY_DIR}/examples"
)

# INTERFACE targets can't provide sources, so not all IDEs can properly
# discover files belonging to targets. This is a portable way to do just that.
set(
        fplus_headers
        benchmark_session.hpp
        compare.hpp
        composition.hpp
        container_common.hpp
        container_properties.hpp
        container_traits.hpp
        curry.hpp
        curry_instances.autogenerated_defines
        extrapolate.hpp
        filter.hpp
        fplus.hpp
        function_traits.hpp
        fwd.hpp
        fwd_instances.autogenerated_defines
        generate.hpp
        internal/apply.hpp
        internal/asserts/composition.hpp
        internal/asserts/functions.hpp
        internal/asserts/pairs.hpp
        internal/compare.hpp
        internal/composition.hpp
        internal/container_common.hpp
        internal/function_traits_asserts.hpp
        internal/invoke.hpp
        internal/meta.hpp
        internal/split.hpp
        interpolate.hpp
        maps.hpp
        maybe.hpp
        numeric.hpp
        optimize.hpp
        pairs.hpp
        queue.hpp
        raii.hpp
        read.hpp
        replace.hpp
        result.hpp
        search.hpp
        sets.hpp
        shared_ref.hpp
        show.hpp
        side_effects.hpp
        split.hpp
        stopwatch.hpp
        string_tools.hpp
        timed.hpp
        transform.hpp
        tree.hpp
        variant.hpp
)
list(
        TRANSFORM
        fplus_headers
        PREPEND
        "${FunctionalPlus_SOURCE_DIR}/include/fplus/"
)

file(
        WRITE
        "${PROJECT_BINARY_DIR}/fplus_sources.generated.cpp"
        "// Generated by CMake, DO NOT EDIT\n"
)
add_executable(
        fplus_sources
        EXCLUDE_FROM_ALL
        "${PROJECT_BINARY_DIR}/fplus_sources.generated.cpp"
        ${fplus_headers}
)
target_link_libraries(fplus_sources PRIVATE FunctionalPlus::fplus)
